package com.usian.user.controller.v1;

import com.usian.apis.user.ApUserRealnameControllerApi;
import com.usian.common.constans.user.UserConstants.AdminConstans;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.service.ApUserRealNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealNameController implements ApUserRealnameControllerApi {
    @Autowired
    private ApUserRealNameService apUserRealNameService;
    @Override
    @RequestMapping("/list")
    public ResponseResult loadListByStatus(AuthDto dto) {
        return apUserRealNameService.loadListByStatus(dto);
    }
    @PostMapping("/authPass")
    @Override
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        dto.setStatus(AdminConstans.PASS_AUTH);
        return apUserRealNameService.updateStatusById(dto, AdminConstans.PASS_AUTH);
    }
    @PostMapping("/authFail")
    @Override
    public ResponseResult authFail(@RequestBody AuthDto dto) {
        dto.setStatus(AdminConstans.FAIL_AUTH);
        return apUserRealNameService.updateStatusById(dto, AdminConstans.FAIL_AUTH);
    }
}
